const cacheName = 'QUESTION_MODULE_QUESTION'
const state = {
  questionVo: {}
}

const mutations = {
  QUESTION_MODULE_SET_QUESTION: (state, current) => {
    state.questionVo = current
    sessionStorage.setItem(cacheName, JSON.stringify(current))
  },
  QUESTION_MODULE_RESTORE_QUESTION: (state) => {
    if (!state.questionVo.questionId) {
      state.questionVo = JSON.parse(sessionStorage.getItem(cacheName))
    }
  }
}

export default {
  state,
  mutations
}
